// component/tab.js.js
Component({

  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    selected: 0,
    color: '#cccccc',
    selectedColor: '#40e0d0',
    list: [{
      pagePath: '/pages/main/main',
      iconPath: '/assets/images/home.png',
      selectedIconPath: '/assets/images/home_selected.png',
      text: '主页'
    }, {
      pagePath: '/pages/project/project',
      iconPath: '/assets/images/pro.png',
      selectedIconPath: '/assets/images/pro_selected.png',
      text: '项目'
    },
    {
      pagePath: '/pages/official/official',
      iconPath: '/assets/images/nav.png',
      selectedIconPath: '/assets/images/nav_selected.png',
      text: '导航'
    },
    {
      pagePath: '/pages/me/me',
      iconPath: '/assets/images/me.png',
      selectedIconPath: '/assets/images/me_selected.png',
      text: '我的'
    }]
  },
  attached() {
  },
  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({
        url: url
      })
      this.setData({
        selected: data.index
      })
    }
  }
})